const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
  entry: './src/main.ts',
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: '[name].js',
    library: 'angular-app',
    libraryTarget: 'umd',
    publicPath: '//localhost:3003/',
    uniqueName: 'angular-app'
  },
  resolve: {
    extensions: ['.ts', '.js']
  },
  module: {
    rules: [
      {
        test: /\.ts$/,
        use: {
          loader: 'ts-loader',
          options: {
            compilerOptions: {
              noImplicitAny: false,
              strictPropertyInitialization: false
            }
          }
        },
        exclude: /node_modules/
      }
    ]
  },
  plugins: [
    new HtmlWebpackPlugin({
      template: './public/index.html'
    })
  ],
  devServer: {
    port: 3003,
    headers: {
      'Access-Control-Allow-Origin': '*'
    },
    historyApiFallback: true
  }
};